using System;
using System.Drawing;
using System.Text;

namespace Jonathan.XhtmlRichTextBox
{
    /// <summary>
    /// Summary description for RtfDocument.
    /// </summary>
    public class RtfDocument
    {
        private RtfFontTable fonttbl;
        private RtfColorTable colortbl;
        private string header;
        private StringBuilder document;

        public RtfDocument ()
        {
            //
            // TODO: Add constructor logic here
            //
            document = new StringBuilder();
            header = "{\\rtf1";
            fonttbl = new RtfFontTable();
            colortbl = new RtfColorTable();
        }

        public override string ToString ()
        {
            header += fonttbl.ToString() + colortbl.ToString();
            return header + "{" + document.ToString() + "}}";
        }

        public void AppendText (string text)
        {
            document.Append(text);
        }

        public int UseFont (string fontName)
        {
            return fonttbl.UseFont(fontName);
        }

        public int UseColor (Color fromArgb)
        {
            return colortbl.UseColor(fromArgb);
        }
    }
}
